Skip to content

fix(logs,metrics): Attach user attributes to logs and metrics regardless of sendDefaultPii#5099

Merged
romtsn merged 3 commits intomainfrom
fix/user-attributes-logs-metrics
Feb 13, 2026
Merged

fix(logs,metrics): Attach user attributes to logs and metrics regardless of sendDefaultPii#5099
romtsn merged 3 commits intomainfrom
fix/user-attributes-logs-metrics

Conversation

@romtsn
Copy link
Member

@romtsn romtsn commented Feb 13, 2026

Summary

  • When a user is explicitly set on the scope, user.id, user.name, and user.email are now always attached to log and metric attributes, regardless of the sendDefaultPii flag
  • This matches the existing behavior for error events (SentryClient.applyScope), which copies scope user without checking sendDefaultPii

Fixes #5078

Test plan

  • Updated existing tests to verify user attributes are attached even when sendDefaultPii is false
  • Verified distinct-id fallback tests no longer require sendDefaultPii = true
  • All tests pass locally

🤖 Generated with Claude Code

…aultPii

When a user is explicitly set on the scope, user.id, user.name, and
user.email are now always attached to log and metric attributes, matching
the existing behavior for error events (SentryClient.applyScope).

Fixes #5078

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (distribution) Add installGroupsOverride parameter by runningcode in #5066
  • (replay) Track custom masking usage via integration by markushi in #5070

Bug Fixes 🐛

  • (android) Merge tombstone and Native SDK event message. by supervacuus in #5095
  • (logs,metrics) Attach user attributes to logs and metrics regardless of sendDefaultPii by romtsn in #5099

Internal Changes 🔧

Deps

  • Update Native SDK to v0.12.7 by github-actions in #5098
  • Bump getsentry/craft from 2.20.1 to 2.21.2 by dependabot in #5083
  • Bump github/codeql-action from 4.32.0 to 4.32.2 by dependabot in #5082
  • Update Native SDK to v0.12.6 by github-actions in #5071

Other

  • Session Replay: Add PreviewView to default masked view classes by szijpeter in #5097
  • No longer log a warning if a logging integration cannot initialize Sentry due to missing DSN. by adinauer in #5075
  • Fix thread leak caused by eager creation of SentryExecutorService in SentryOptions by adinauer in #5093

🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@adinauer adinauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@romtsn romtsn changed the title fix: Attach user attributes to logs and metrics regardless of sendDefaultPii fix(logs,metrics): Attach user attributes to logs and metrics regardless of sendDefaultPii Feb 13, 2026
@romtsn romtsn enabled auto-merge (squash) February 13, 2026 11:53
@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 356.49 ms 453.29 ms 96.80 ms
Size 1.58 MiB 2.29 MiB 719.82 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a416a65 333.78 ms 410.37 ms 76.59 ms
d15471f 342.08 ms 415.44 ms 73.35 ms
e59e22a 329.74 ms 383.31 ms 53.57 ms
d15471f 315.20 ms 370.22 ms 55.02 ms
d364ace 382.77 ms 443.21 ms 60.44 ms
b3d8889 371.33 ms 426.24 ms 54.92 ms
a416a65 316.52 ms 359.67 ms 43.15 ms
b03edbb 352.20 ms 423.69 ms 71.49 ms
d15471f 304.55 ms 408.43 ms 103.87 ms
319f256 315.96 ms 372.96 ms 57.00 ms

App size

Revision Plain With Sentry Diff
a416a65 1.58 MiB 2.12 MiB 555.26 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
e59e22a 1.58 MiB 2.20 MiB 635.34 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
d364ace 1.58 MiB 2.11 MiB 539.75 KiB
b3d8889 1.58 MiB 2.10 MiB 535.07 KiB
a416a65 1.58 MiB 2.12 MiB 555.26 KiB
b03edbb 1.58 MiB 2.13 MiB 557.32 KiB
d15471f 1.58 MiB 2.13 MiB 559.54 KiB
319f256 1.58 MiB 2.19 MiB 619.79 KiB

@romtsn romtsn merged commit ad8da22 into main Feb 13, 2026
62 of 63 checks passed
@romtsn romtsn deleted the fix/user-attributes-logs-metrics branch February 13, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make user.id a required attribute in Logs

2 participants